lib/repo: Allow min-free-space-size and -percent to co-exist
authorUmang Jain <umang@endlessm.com>
Mon, 16 Jul 2018 12:27:20 +0000 (17:57 +0530)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 20 Jul 2018 14:58:40 +0000 (14:58 +0000)
commit66079c7b65ec3524db0f1abdca5516c0f3837222
tree18eb9409bc8ea619f7d6192d2ae8aba6bcb9a3a1
parent7306577e61563d70eb67240dc275e18006882e53
lib/repo: Allow min-free-space-size and -percent to co-exist

Previously, we would error out if both of the options were mentioned
in the config file (even if one of them is disabled with 0). There
were few suggestions that this behavior was not quite right.

Therefore, instead of throwing error and exiting, it's preferred to
warn the user. Hence, the solution that worked out is:
* Allow both options to exist simulateneously
* Check each config's value and decide:
  * If both are present and are non-zero, warn the user. Also, prefer
    to use min-free-space-size over the another.
  * If both are absent, then use -percent=3% as fallback
  * Every other case is valid hence, no warning

https://phabricator.endlessm.com/T13698
(cherry picked from commit be68991cf80f0aa1da7d36ab6e1d2c4d6c7cd3fb)
Signed-off-by: Robert McQueen <rob@endlessm.com>
Closes: #1685
Approved by: cgwalters
man/ostree.repo-config.xml
src/libostree/ostree-repo.c